/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package graphique;

import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;

import javax.swing.JButton;
import javax.swing.JPanel;

/**
 *
 * @author adeline
 */
public class DetailEvent extends JPanel{

    private static final long serialVersionUID = 1L;
    private Label[] labelsType;
    private Label[] labelsDesc;
    private Label[] labelsComm;
    private Label[] labelsDate;
    
    public DetailEvent() {
    }

    /**
     * 
     * @param event
     */
    public void showDetail(Object[] event){

    	removeAll();
        //System.out.println("On affiche le detail !");
        int nb = event.length;
        System.out.println("nb vaut "+nb);
        labelsComm = new Label[nb];
        labelsDate = new Label[nb];
        labelsDesc = new Label[nb];
        //labelsType = new Label[nb];
        
        for (int i=0;i<nb;i++)
        {
            labelsComm[i] = new Label(((modele.Event)event[i]).getCommentaire());
            labelsDesc[i] = new Label(((modele.Event)event[i]).getDescription());
            Calendar d =  ((modele.Event)event[i]).getDate();
            String heure = ""+d.HOUR_OF_DAY+" : "+d.MINUTE;
            labelsDate[i] = new Label(heure);
            //String type = ((modele.Event)event[i]).getClass().getName();
            //String type2 = type.substring(7);
            //labelsType[i] = new Label(type2);
        }
        
        //affichage
        for (int i=0;i<nb;i++)
        {
            add(labelsDate[i]);
            labelsDate[i].setLocation(10, 30+(30*i));
            //add(labelsType[i]);
            add(labelsDesc[i]);
            labelsDate[i].setLocation(40, 30+(30*i));
            add(labelsComm[i]);
            labelsDate[i].setLocation(60, 30+(30*i));
        }
             
        repaint();
        setVisible(true);
    }
}
